<template>
  <view class="root">
    <parser :html="detail.detail"></parser>
  </view>
</template>

<script>
import Api from "@/utils/Api";
import Parser from "@/components/jyf-parser/jyf-parser";

export default {
  components: {Parser},
  data() {
    return {
      id: null,
      detail: {},
    }
  },
  onLoad(options) {
    options = this.core.decodeURIComponentObject(options);
    this.id = options.id;
    console.log(options)
    this.getArticle();
  },
  methods: {
    getArticle() {
      console.log("getArticle")
      Api.getNewsDetail(this.id).then(res => {
        console.log(res)
        this.detail = res;
        uni.setNavigationBarTitle({title: res.title})
      })
    },
  },
}
</script>

<style scoped lang='scss'>
.root {
  padding: r(20px);
}
</style>